package com.xtayfjpk.mbassador.test.listener;

import net.engio.mbassy.listener.Enveloped;
import net.engio.mbassy.listener.Handler;
import net.engio.mbassy.listener.Invoke;
import net.engio.mbassy.listener.Listener;
import net.engio.mbassy.listener.References;
import net.engio.mbassy.subscription.MessageEnvelope;

@Listener(references=References.Strong)
public class EnvelopedMessageListener {

    @Handler(condition = "msg.size >= 50", delivery = Invoke.Asynchronously)
    @Enveloped(messages = {MyEvent.class})
    public void handleLarge(MessageEnvelope envelope) {
    	System.out.println("handle large file:" + envelope);
    }
    
    
    public static class MyEvent {
    	private int size = 100;

		public MyEvent(int size) {
			this.size = size;
		}
		public int getSize() {
			return size;
		}
		public void setSize(int size) {
			this.size = size;
		}
    	
    }
}
